/*Yipeng Huang and Scott Rogowski*/
/*yh2315 smr2167*/

//Very simple stage, perform the write back.  This could be combined with the Fetch stage but for sanity it will be its own.
module WriteBackStage(mem_to_register, ALU_result, data_memory_value, register_write_data);
	
	input mem_to_register;
	input [31:0] ALU_result;
	input [31:0] data_memory_value;
	
	output [31:0] register_write_data;
	
	//Decide whether to write the ALU result back to the register or recalled data_memory
	TwoToOneMultiplexer m (.mux_in_0(data_memory_value), .mux_in_1(ALU_result), .selector(mem_to_register), .mux_out(register_write_data));
	
	endmodule